<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      table {
          width: 600px;
          text-align: center;
          border-bottom: solid 2px #DDD;
          /* 合并边框 */
          border-collapse: collapse;
      }
      td,th {
          border-bottom: solid 1px #DDD;
          height: 40px;
      }
  </style>
  </head>
  <body>
    <div id="app">{{ msg }}
      <hr />
       <!-- 架子 -->
    <table>
      <thead>
         <tr>
          <th>userId</th>
          <th>userName</th>
          <th>userSex</th>
          <th>userAge</th>
         </tr>
      </thead>
      <tbody id="tbody">
        <tr v-for="(user,index ) in  userArr" :key=" 'tbody' +  index">
          <td>{{user.userId}}</td>
          <td>{{user.userName}}</td>
          <td>{{user.userName}}</td>
          <td>{{index}}</td>
        </tr>

        <!-- <template v-for=" user   in   userArr">
            <tr>
              <td>{{user.userId}}</td>
              <td>{{user.userName}}</td>
              <td>{{user.userName}}</td>
              <td>{{user.userSex}}</td>            
            </tr>
        </template> -->
        
      </tbody>
  </table>

    </div>
  </body>
</html>
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
<script>
  const app = Vue.createApp({
    data() {
      //  定义对象的属性
      return {
        userArr: [
          {
            userId: 1,
            userName: "张三",
            userSex: "男",
            userAge: 20,
          },
          {
            userId: 2,
            userName: "李四",
            userSex: "女",
            userAge: 21,
          },
          {
            userId: 3,
            userName: "王五",
            userSex: "男",
            userAge: 22,
          },
        ],
      };
    },
  });
  app.mount("#app");
</script>
